package com.kevin.servlet3;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRegistration;
import javax.servlet.annotation.WebListener;

@WebListener()
public class ServletListener implements ServletContextListener {

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		System.out.println("contextDestroyed");
	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		System.out.println("contextInitialized");

		ServletContext sc = arg0.getServletContext();

		ServletRegistration sr = sc.addServlet("Servlet2",
				"com.kevin.servlet3.Servlet2");

		sr.addMapping("/Servlet2");

		System.out.println("added Servlet2");

	}

}
